<?php
/**
 * Api控制器
 */
namespace app\manage\controller\option;
use app\manage\controller\Base;
use think\Cache;
class Api extends Base
{

	/**
	 * 清空缓存
	 * @return [type] [description]
	 */
    public function clearCache(){
    	Cache::clear();
    	$this->success('操作完成');
    }

    public function get(){
    	$params = $this->request->param();
    	$option_name = isset($params['option_name'])?$params['option_name']:'';
    	
    	if(!$option_name)
    		return json(['code'=>0,'msg'=>'请求参数错误']);

    	$data = \app\common\model\Option::getOne($option_name);

    	if(false===$data){
    		return json(['code'=>0,'msg'=>'配置不存在']);
        }else{
            if($option_name=='withdraw_days'){
                $data = explode(',', ltrim($data,','));
            }
    		return json(['code'=>1,'data'=>$data]);
        }
    }

}

